kind: DeploymentConfig
apiVersion: v1
metadata:
  name: "{{deploy_name}}"
  labels:
    provisioners-infra: "{{name}}"
    name: "{{name}}"
spec:
  replicas: {{replica_count}}
  selector:
    provisioners-infra: "{{name}}"
    name: "{{name}}"
  strategy:
    type: Recreate 
  template:
    metadata:
      name: "{{deploy_name}}"
      labels:
        provisioners-infra: "{{name}}"
        name: "{{name}}"
    spec:
      serviceAccountName: "{{deploy_serviceAccount}}"
{% if node_selector is iterable and node_selector | length > 0 %}
      nodeSelector:
{% for key, value in node_selector.items() %}
        {{key}}: "{{value}}"
{% endfor %}
{% endif %}
      containers:
        - name: efs-provisioner
          image: {{openshift_provisioners_image_prefix}}efs-provisioner:{{openshift_provisioners_image_version}}
          env:
            - name: AWS_ACCESS_KEY_ID
              valueFrom:
                secretKeyRef:
                  name: provisioners-efs
                  key: aws-access-key-id
            - name: AWS_SECRET_ACCESS_KEY
              valueFrom:
                secretKeyRef:
                  name: provisioners-efs
                  key: aws-secret-access-key
            - name: FILE_SYSTEM_ID
              value: "{{openshift_provisioners_efs_fsid}}"
            - name: AWS_REGION
              value: "{{openshift_provisioners_efs_region}}"
            - name: PROVISIONER_NAME
              value: "{{openshift_provisioners_efs_name}}"
          volumeMounts:
            - name: pv-volume
              mountPath: /persistentvolumes
      securityContext:
        supplementalGroups:
          - {{openshift_provisioners_efs_supplementalgroup}}
      volumes:
        - name: pv-volume
          persistentVolumeClaim:
            claimName: "{{claim_name}}"
